[PATCH] stream/reassembly: improve progress tracking for GAP cases
authorVictor Julien <vjulien@oisf.net>
Mon, 9 Mar 2026 10:56:55 +0000 (11:56 +0100)
committerAndreas Dolp <dev@andreas-dolp.de>
Thu, 23 Apr 2026 05:14:21 +0000 (07:14 +0200)
When during raw reassembly it is detected that last ack is moved beyond
the progress and also beyond the data retrieved, update progress to the
last ack value.

Bug: #8272.
(cherry picked from commit ac1a514c7b57ea24f603020ef790c59b84143244)

Origin: upstream, https://github.com/OISF/suricata/commit/fecaa08f591c508b6486e7e9a2ee05636d1f9503.patch
Bug: https://redmine.openinfosecfoundation.org/issues/8365
Subject: Upstream fix for CVE-2026-31933

Gbp-Pq: Name CVE-2026-31933.patch

src/stream-tcp-reassemble.c

index 31e338838824b937c6877cdb9719146b6342308a..37cbfeceea3631d138090e80cceda5e6bb0f4efd 100644 (file)
@@ -1872,6 +1872,12 @@ static int StreamReassembleRawDo(const TcpSession *ssn, const TcpStream *stream,
             progress = mydata_offset;
             SCLogDebug("raw progress now %"PRIu64, progress);
 
+            /* data is beyond the progress we'd like, and also beyond the last ack:
+             * there is a gap and we can't expect it to get filled anymore. */
+        } else if (mydata_offset > progress && mydata_offset == re) {
+            SCLogDebug("mydata_offset %" PRIu64 ", progress %" PRIu64 ", re %" PRIu64,
+                    mydata_offset, progress, re);
+            progress = re;
         } else {
             SCLogDebug("not increasing progress, data gap => mydata_offset "
                        "%"PRIu64" != progress %"PRIu64, mydata_offset, progress);